namespace FaultDiagnosisSystem.Models.DataModels
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class TurbineFaultContext : DbContext
    {
        public TurbineFaultContext()
            : base("name=TurbineFaultConnection")
        {
        }

        public virtual DbSet<Component> Component { get; set; }
        public virtual DbSet<RealTimeFault> RealTimeFault { get; set; }
        public virtual DbSet<RealTimeFaultData> RealTimeFaultData { get; set; }
        public virtual DbSet<RealTimeFaultDataDaily> RealTimeFaultDataDaily { get; set; }
        public virtual DbSet<Sensor> Sensor { get; set; }
        public virtual DbSet<TenMeanData> TenMeanData { get; set; }
        public virtual DbSet<TenMeanFarmData> TenMeanFarmData { get; set; }
        public virtual DbSet<TrendModel> TrendModel { get; set; }
        public virtual DbSet<TrendStableValue> TrendStableValue { get; set; }
        public virtual DbSet<Turbine> Turbine { get; set; }

        public virtual DbSet<v_TenMeanData> v_TenMeanData { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Component>()
                .HasMany(e => e.Sensor)
                .WithRequired(e => e.Component)
                .WillCascadeOnDelete(false);

            modelBuilder.Entity<Turbine>()
                .HasMany(e => e.TenMeanData)
                .WithRequired(e => e.Turbine)
                .WillCascadeOnDelete(false);
        }
    }
}
